home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v8n02.arc
/
USED.C
< prev
Wrap
C/C++ Source or Header
|
1989-01-08
|
610b
|
31 lines
/* used.c
calculates total bytes occupied by filespec passed on command line
If no parameter is passed, defaults to '*.*'
*/
#include <dos.h>
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
struct find_t SpaceUsedBy;
long total = 0L;
if (argc < 2)
{
printf("\nUsage: used <filespec>\n");
exit(1);
}
if(!_dos_findfirst(argv[1],_A_NORMAL,&SpaceUsedBy))
total = SpaceUsedBy.size;
while(!_dos_findnext(&SpaceUsedBy))
total += SpaceUsedBy.size;
printf("\n%s uses %ld bytes\n",argv[1],total);
}